home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGNG_C
/
M2DOC.LZH
/
BADSIEV1.MOD
next >
Wrap
Text File
|
1987-07-04
|
865b
|
38 lines
MODULE sieve;
(* $L+ *)
FROM InOut IMPORT Read, Write, WriteString, WriteCard, WriteLn;
CONST
SIZE = 8190;
ITER = 10;
VAR
flag :ARRAY [0..SIZE] OF BOOLEAN;
i, j, k, count, prime :CARDINAL;
ch :CHAR;
BEGIN
WriteString("Hit a key to start 10 ITERATIONS");
Read(ch); WriteLn;
FOR i := 1 TO ITER DO
cnt := 0;
FOR j := 0 TO 10000 DO
flag[j] := TRUE;
END;
FOR j := 0 TO SIZE DO
IF flag[j] THEN
prime := j+j+3;
k := j+prime;
WHILE k <= SIZE DO
flag[k] := FALSE;
INC(k,prime);
END;
INC(count);
END;
END;
END;
Write(7C); WriteCard(count);
END sieve.